#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,d;
loop:
	try{
		while(~scanf("%d.%d.%d.%d",&a,&b,&c,&d))
		{
			if(!(0<=a&&a<=255) || !(0<=b&&b<=255) ||
			!(0<=c&&c<=255) || !(0<=d&&d<=255))
				cout<<"N"<<endl;
			else
				cout<<"Y"<<endl;
		}
	}catch(exception e){
		cout<<"N"<<endl;
		goto loop;
	}
    return 0;
}
